package com.size.mall.manager.pms_base.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.size.mall.mallapi.entity.Catalog1;
import com.size.mall.mallapi.entity.Catalog2;
import com.size.mall.mallapi.entity.Catalog3;
import com.size.mall.mallapi.service.Catalog1Service;
import com.size.mall.mallapi.service.Catalog2Service;
import com.size.mall.mallapi.service.Catalog3Service;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 一级分类表 前端控制器
 * </p>
 *
 * @author yin
 * @since 2019-10-24
 */
@RestController
@CrossOrigin
public class Catalog1Controller {
    @Reference
    Catalog1Service catalog1Service;
    @Reference

    Catalog2Service catalog2Service;
    @Reference
    Catalog3Service catalog3Service;

    @PostMapping("/getCatalog1")
    public List<Catalog1> getCatalog1() {


        return catalog1Service.list(null);

    }

    @PostMapping("/getCatalog2")
    public List<Catalog2> getCatalog2(String catalog1Id) {

        List<Catalog2> list = catalog2Service.getCatalog2(catalog1Id);
        return list;

    }

    @PostMapping("/getCatalog3")
    public List<Catalog3> getCatalog3(String catalog2Id) {

        List<Catalog3> list = catalog3Service.getCatalog3(catalog2Id);

        return list;

    }


}

